<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <!-- link rel="stylesheet" title="Default" href="http://acm.math.spbu.ru/~sk1/colorer/my.css" -->

  <link rel="stylesheet" href="http://acm.math.spbu.ru/~sk1/colorer1/xcode.css">
  <script src="http://acm.math.spbu.ru/~sk1/colorer1/highlight.pack.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>

  <!--script src="http://acm.math.spbu.ru/~sk1/colorer/highlight.js"></script>
  <script src="http://acm.math.spbu.ru/~sk1/colorer/cpp.js"></script>
  <script>hljs.initHighlightingOnLoad();</script -->
</head>

<body>

<pre><code>
#include &lt;cstdio&gt;
#include &lt;cstring&gt;

#define forn(i, n) for (int i = 0; i &lt; n; i++)

#define maxn 153
#define maxv (maxn * 2)

int n, c[maxv][maxv], w[maxv][maxv];
int d[maxv], u[maxv], la[maxv];

int main()
{
  int sum = 0;

  scanf("%d", &n);
  memset(c, 0, sizeof(c));
  memset(w, 0, sizeof(w));
  forn(i, n)
    forn(j, n)
    {
      scanf("%d", &w[i][j + n]);
      sum += w[i][j + n];
      w[i][j + n] = 100 - w[i][j + n];
      w[j + n][i] = -w[i][j + n];
      c[i][j + n] = 1;
    }
    
  int st = n + n, en = st + 1;
  forn(i, n)
    c[st][i] = c[i + n][en] = 1;

  int N = n + n + 2;
  forn(k, n)
  {
    forn(i, N)
      d[i] = (int)1e9, u[i] = 0;
    d[st] = 0;
    
    int run = 1;
    while (run)
    {
      run = 0;
      forn(i, N)
        forn(j, N)
          if (c[i][j] &gt; 0 && d[j] &gt; d[i] + w[i][j])
            d[j] = d[i] + w[i][j], la[j] = i, run = 1;
    }

    int i = en;
    while (i != st)
    {
      int j = la[i];
      c[j][i]--, c[i][j]++;
      i = j;
    }
  }

  forn(j, n)
    forn(i, n)
      if (c[i][j + n] == 0)
        sum -= 100 - w[i][j + n];
  printf("%d\n", sum);
  return 0;
}

</code></pre>

</body>
</html>

<font style="visibility:hidden">
